import {useState, useEffect} from 'react';

function Demo () {
    const [count, setCount] = useState(0);
    useEffect(() => {
        document.title = `you clicked ${count} times`;
        console.log('clicked')
    })
    // 组件第一次渲染后和每次更新都会执行
    return (
        <div>
            <p>you clicked {count} times</p>
            <button onClick={() => {setCount(count + 1)}}>click me</button>
        </div>
    )
}

export default Demo;